-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add amino compatibility layer for proto Any #6151
Conversation
👋 Thanks for creating a PR! Before we can merge this PR, please make sure that all the following items have been For contributor use:
For admin use:
Thank you for your contribution to the Cosmos-SDK! 🚀 |
Codecov Report
@@ Coverage Diff @@
## master #6151 +/- ##
==========================================
+ Coverage 54.67% 54.72% +0.04%
==========================================
Files 441 443 +2
Lines 26592 26703 +111
==========================================
+ Hits 14539 14612 +73
- Misses 11034 11052 +18
- Partials 1019 1039 +20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK. To be honest, and it could very well be just me, but I find this level of indirection of codec passing/usage extremely confusing. I had to go back and forth between files/types numerous times to really see what's happening.
But as long as it works (which it seems to) and the user-level API remains clean and minimal, that is the important part -- I doubt this code will change much.
Yeah, so a few things make it complex:
So this solution basically takes advantage of the fact that the Does that help explain things at all? |
This PR adds backwards compatibility for Amino binary and JSON encoding for structs that choose to encode interfaces with
google.protobuf.Any
instead of plain go interfaces.Structs that follow the guidelines laid out in #6081 (implementation of
UnpackInterfaceMessages
) should have identical Amino binary and JSON encoding as the previous structs (withoutAny
) ifAminoCodec
is used to marshal/unmarshal them.